/* Copyright (c) 2010 OFXKit
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#import <Foundation/Foundation.h>
#import "OFXObject.h"
#import "OFXApplication.h"
#import "OFXRequest.h"
#import "OFXFinancialInstitution.h"

@interface OFXSignOnRequest : OFXObject <OFXRequest>  {
  NSString* accessKey;
  NSString* authenticationToken;
  NSDate*   clientDate;
  OFXFinancialInstitution* financialInstitution;
  bool generateUserKey;
  NSString* userCredential1;
  NSString* userCredential2;
  NSString* userId;
  NSString* userKey;
  NSString* userPassword;
  OFXApplication* ofxApplication;
  NSMutableArray* multiFactorAuthentication;
}

/**
 * @property accessKey
 * @brief If the client and server support the MFACHALLENGE request/response 
 * and/or the authentication token functionality, the signon request may 
 * include the <ACCESSKEY> tag. When provided by the server, the client will 
 * send the last value of the <ACCESSKEY> it has received.
 */
@property(retain) NSString* accessKey;

/**
 * @property authenticationToken
 * @brief Authentication token required for this signon session only. 
 * Credential is provided to the user out of band, A-171
 * 
 * Note: the effective size of AUTHTOKEN is A-32. However, if Type 1 security 
 * is used, then the actual field length is A-171.
 */
@property(retain) NSString* authenticationToken;

/**
 * @property clientDate
 * @brief Date and time of the request from the client computer
 *
 * This value should reflect the time (according to the client machine) when 
 * the request file is sent to the server, not the (original) creation time of 
 * the request file. While not required for existing software, OFX 2.1.1 
 * clients must comply with this rule. This clarification is particularly 
 * important in error recovery situations in which the request file may be sent 
 * to the server after its initial creation.
 */
@property(retain) NSDate*   clientDate;

/**
 * @property financialInstitution
 * @brief The financial institution to request informtion from.
 */
@property(retain) OFXFinancialInstitution* financialInstitution;

/**
 * @property generateUserKey
 * @brief Request server to return a USERKEY for future use
 */
@property(assign) bool generateUserKey;

/**
 * @property userCredential1
 * @brief Additional user credential required by server, A-171 
 * 
 * Note: the effective size of USERCRED1 is A-32. However, if Type 1 security 
 * is used, then the actual field length is A-171.
 */
@property(retain) NSString* userCredential1;

/**
 * @property userCredential2
 * @brief Additional user credential required by server, A-171 
 * 
 * Note: the effective size of USERCRED2 is A-32. However, if Type 1 security 
 * is used, then the actual field length is A-171.
 */
@property(retain) NSString* userCredential2;

/**
 * @property userId
 * @brief User identification string. To ensure security and help prevent 
 * identity fraud, Financial Institutions are discouraged from using Social 
 * Security Number for Customer ID or PIN/Password. A-32
 */
@property(retain) NSString* userId;

/**
 * @property userKey
 * @brief Log in using previously authenticated context, A-64
 */
@property(retain) NSString* userKey;

/**
 * @property userPassword
 * @brief User password on server
 *
 * Note:	The maximum clear text length of USERPASS is 32 characters: a client 
 * must not send a longer password. However, when using Type 1 security, the 
 * encrypted value may extend to 171 characters.
 */
@property(retain) NSString* userPassword;  

/**
 * @property ofxApplication
 * @brief Requesting application information
 */
@property(retain) OFXApplication* ofxApplication;

/**
 * @property multiFactorAuthentication
 * @brief MFA challenge question/answer aggregates
 */
@property(retain) NSMutableArray* multiFactorAuthentication;

- (id)init;

@end
